var t = getApp();

Page({
    data: {
        hiddenmodalput: !0,
        nameInput: "",
        _num: 0,
        Wshow: !1,
        cdDisReason: "",
        nmDisReason: ""
    },
    menuClick: function(t) {
        console.log(t.target.dataset), this.setData({
            _num: t.target.dataset.num,
            nmDisReason: t.target.dataset.text,
            cdDisReason: t.target.dataset.uuid
        });
    },
    Wconfirm: function(a) {
        var e = this, o = wx.getStorageSync("log") || "", n = wx.getStorageSync("patientid") || "";
        wx.request({
            url: t.globalData.dic + "doctor/sign/break/" + o + "/" + n,
            data: {
                cdDisReason: e.data.cdDisReason,
                nmDisReason: e.data.nmDisReason
            },
            method: "POST",
            header: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                console.log(t.data), 200 == t.data.code && (e.setData({
                    Wshow: !1
                }), e.onClock1());
            }
        });
    },
    Wcall: function(t) {
        this.setData({
            Wshow: !1
        });
    },
    shu: function(a) {
        console.log(a.currentTarget.dataset.patientid), wx.request({
            url: t.globalData.dic + "doctor/manage/showPatientAllowArchives/" + a.currentTarget.dataset.patientid,
            success: function(t) {
                console.log(t.data.data), 1 != t.data.data ? wx.showModal({
                    title: "提示",
                    content: "患者没有授权",
                    success: function(t) {
                        t.confirm ? console.log("用户点击确定") : t.cancel && console.log("用户点击取消");
                    }
                }) : (wx.setStorageSync("patientId", a.currentTarget.dataset.patientid), wx.navigateTo({
                    url: "/hyb_yl/index/healthRecord/healthRecord"
                }));
            }
        });
    },
    nameInput: function(t) {
        this.setData({
            nameInput: t.detail.value
        });
    },
    cancel: function() {
        this.setData({
            hiddenmodalput: !0
        });
    },
    confirm: function() {
        var a = this, e = wx.getStorageSync("log") || "", o = wx.getStorageSync("creater") || "", n = wx.getStorageSync("groupid") || "";
        a.setData({
            hiddenmodalput: !0
        }), console.log(a.data.nameInput), wx.request({
            url: t.globalData.dic + "doctor/manage/group/update/" + e,
            data: {
                groupName: a.data.nameInput,
                creater: o,
                groupId: n
            },
            method: "POST",
            header: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                console.log(t.data), a.setData({
                    name: a.data.nameInput
                });
            }
        });
    },
    sectionalizationImg: function(a) {
        var e = this;
        wx.getStorageSync("log");
        wx.showActionSheet({
            itemList: [ "重命名分组", "解散分组" ],
            success: function(a) {
                console.log(a.tapIndex), 0 == a.tapIndex ? e.setData({
                    hiddenmodalput: !e.data.hiddenmodalput
                }) : wx.showModal({
                    title: "解散分组",
                    content: "确认解散分组吗？",
                    success: function(a) {
                        if (a.confirm) {
                            var e = wx.getStorageSync("log") || "", o = wx.getStorageSync("groupid") || "";
                            wx.request({
                                url: t.globalData.dic + "doctor/manage/group/delete/" + e + "/" + o,
                                success: function(t) {
                                    console.log(t.data), wx.navigateBack({
                                        delta: 1
                                    });
                                }
                            });
                        } else a.cancel;
                    }
                });
            }
        });
    },
    sectionalizationImg1: function(t) {
        var a = this;
        console.log(t.currentTarget.dataset.patientid), console.log(t.currentTarget.dataset.name);
        t.currentTarget.dataset.patientid, wx.getStorageSync("log");
        var e = wx.getStorageSync("groupid") || "";
        wx.showActionSheet({
            itemList: [ "移动到其他分组", "解除签约" ],
            success: function(o) {
                console.log(o.tapIndex), 0 == o.tapIndex ? (wx.setStorageSync("patientid", t.currentTarget.dataset.patientid), 
                wx.setStorageSync("groupid", e), wx.navigateTo({
                  url: "/hyb_yl/index/casControlmovement/casControlmovement"
                })) : 1 == o.tapIndex && a.setData({
                    Wshow: !0
                });
            }
        });
    },
    onShow: function(a) {
        var e = this;
        e.onClock1(), wx.request({
            url: t.globalData.dicc + "dic/comdicbase",
            data: {
                code: 38e4
            },
            success: function(t) {
                console.log(t.data.data);
                var a = t.data.data, o = [], n = [];
                for (var s in a) o.push(a[s]), n.push(s);
                console.log(o[0]), e.setData({
                    text: o,
                    textID: n,
                    cdDisReason: n[0],
                    nmDisReason: o[0]
                });
            }
        });
    },
    onClock1: function(a) {
        var e = this, o = wx.getStorageSync("log") || "";
        wx.request({
            url: t.globalData.dic + "doctor/manage/listPatientWithoutGroup/" + o,
            success: function(t) {
                console.log(t.data), e.setData({
                    UnbankedRegister: t.data.data
                });
            }
        });
    }
});